<?php
/**
 * @copyright meila.com
 * @author @zhanglei11
 * @name 
 * @param 
 *         $userfeed_rid = userfeed_rid表的rid 
 * 
 */
$dir = dirname(dirname(__FILE__));
include($dir.'/__queue_global.php');

class ml_mq_del_feed extends MqClass{
    const QUEUE_NAME = ML_QUEUENAME_DEL_FEED;
    private $oPublicFeed ;
    private $oPicFeed ;
    private $oUserFeed;

    public function __construct($queue)
    {
        $this->oPicFeed = new ml_model_dbPicFeed();
        $this->oPublicFeed = new ml_model_dbPublicFeed();
        $this->oUserFeed = new ml_model_dbUserfeed();
        
        parent::__construct($queue);
    }

    public function run_job(){
        //接收的数据
        $arr = $this->src_data;

        $re = $this->oUserFeed->getUserfeedByRid($arr['userfeed_rid']);
        
        $data = $this->oUserFeed->get_data();

        switch ($data['type'])
        {        
            case ML_FEED_TYPE_PUB_DOTEY:
            case ML_FEED_TYPE_PUB_PIC:
            case ML_FEED_TYPE_REPOST_PIC:
            case ML_FEED_TYPE_REPOST_COLLECTION:
                $this->oPicFeed->delByUserFeedId($arr['userfeed_rid']);
                
            case ML_FEED_TYPE_PUB_SHORT:
            case ML_FEED_TYPE_MOD_DEC:
            case ML_FEED_TYPE_REPOST_SHORT:
            case ML_FEED_TYPE_ATTITUDE:         
            case ML_FEED_TYPE_MOD_TAG:
                $this->oPublicFeed->delByUserFeedId($arr['userfeed_rid']);
                break;
            default:
                break;
        }
        
        return true;
    }
}





ml_run_queue_check(ml_mq_del_feed::QUEUE_NAME);

$conf_array = ml_factory::load_standard_conf('redis');
$conf_array = $conf_array['meila_queue'];
$xblog_obj = new ml_mq_del_feed(new RsQueue(ml_mq_del_feed::QUEUE_NAME));
$argv[1]   = __FILE__;
$xblog_obj->setArgv($argv[1]);
$xblog_obj->execute();
?>